/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.sms.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.Customer;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 店面自动发送的短信Entity
 * @author lvbo
 * @version 2013-06-21
 */
@Entity
@Table(name = "sms_sys_customer_log")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SmsSysCustomer extends BaseEntity {
	final public static int MESSAGE_TYPE_BIRTHDAY = 0;//生日
	final public static int MESSAGE_TYPE_HOLIDAY = 2;//节假日
	final public static int MESSAGE_TYPE_NEW_STORE = 3;//开业通知
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 系统自动给店面客户发送短信编号	（包括：产品和护理项目提示短信、生日和节假日提示短信等）
	private Store store; 		// 门店
	private Customer customer; 	// 客户
	private Date createTime; // 创建日期
	private Date planSendTime;	// 发送日期(查询统计时应按此字段计算)
	private String content;	// 短信内容(带变量，系统计算后固化)
	private int messageType; //客户消息类型：	0 - 生日提醒  	1 - 产品和护理提醒	2 - 节假日提醒

	public SmsSysCustomer() {
	}

	public SmsSysCustomer(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_sms_smsSysCustomer")
	//@SequenceGenerator(name = "seq_sms_smsSysCustomer", sequenceName = "seq_sms_smsSysCustomer")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="store_id", nullable=true)
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="customer_id", nullable=true)
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name="create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name="plan_send_time")
	public Date getPlanSendTime() {
		return planSendTime;
	}

	public void setPlanSendTime(Date planSendTime) {
		this.planSendTime = planSendTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	@Column(name="message_type")
	public int getMessageType() {
		return messageType;
	}

	public void setMessageType(int messageType) {
		this.messageType = messageType;
	}
	
}


